package controllers;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;

import javax.servlet.http.*;

import models.SolutionAdoption;

import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.Query;

@SuppressWarnings("serial")
public class ajxCalculateImplementDayServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/xml");
		PrintWriter out = resp.getWriter();
		
		float impDays = 0;
		
		Objectify ofy = ObjectifyService.begin();
		Query<SolutionAdoption> q = ofy.query(SolutionAdoption.class);  
		for ( SolutionAdoption f : q.fetch() ) {
			impDays = impDays + (Float) f.getImpDays();
		}
		
		out.println("<font style='font-size:13px ; font-weight:bold ; text-align:left'><b>Total days of implementation</font><font style='font-size:13px ; font-weight:bold ; text-align:left ; color:D5711B'> Saved</font><font style='font-size:13px ; font-weight:bold'> through adopting solutions: </font>" + impDays + "<font style='font-size:12px ; font-weight:bold'> days</font>");		
		
	}
}
